//动态导入json数据

var xmlRequest = createXHQ();

xmlRequest.open("GET","../json/close_an_account.json");
xmlRequest.send();

xmlRequest.onreadystatechange=function(){
	
	if(xmlRequest.readyState===4){
		if(xmlRequest.status===200){
			var result1 = xmlRequest.responseText;
			var resultObject = JSON.parse(result1);	
			
			var f_div = document.getElementsByClassName("nav-main")[0];

			var siteMessage = resultObject.userSite[0].region +" "+resultObject.userSite[0].address +" 收货人："+resultObject.userSite[0].name +" 电话："+resultObject.userSite[0].phone;
			
			var totalMoney = 0;
			
			for(var i=0;i<resultObject.shopForm.length;i++){
				
				var divs = document.createElement("div");
				divs.className = "form1";
				
				var text1 = "<div class='form1'>"+
								"<div class='nav-s1-image'>"+
									"<img src="+ resultObject.shopForm[i].shopImage +" />"+
								"</div>"+
								"<div class='nav-s1-text'>"+
									"<span>"+ resultObject.shopForm[i].shopTitle +"</span>"+
								"</div>"+
								"<div class='nav-s1-munber'>"+
									"<span>"+
										"x"+resultObject.shopForm[i].shopNum+
									"</span>"+
								"</div>"+
								"<div class='nav-s1-monays'>"+
									"<span>￥"+ resultObject.shopForm[i].shopMoney +"</span>"+
								"</div>"+
							"</div>";
				
				
				totalMoney += resultObject.shopForm[i].shopMoney; 
				
				
				divs.innerHTML = text1;
				
				f_div.appendChild(divs);
			}
			
			//动态呈现订单总价
			document.getElementsByClassName("jiesuan-monay")[0].getElementsByTagName("em")[0].innerHTML=totalMoney;
			//网页动态呈现收货信息
			document.getElementsByClassName("main-account")[0].getElementsByTagName("span")[0].innerHTML=siteMessage;
			
			document.getElementsByClassName("jiesuan-add")[0].getElementsByTagName("em")[0].innerHTML=siteMessage;
			
		}else{
			alert("错误信息："+xmlRequest.status);
		}
	}
}

//添加事件
window.onload=function(){
	
	//提交表单
	document.getElementById("ok").onclick=function(){
		
		
	}
}